package cug.xxs.jpa.controller;

import cug.xxs.jpa.domain.Model;
import cug.xxs.jpa.service.ModelService;
import cug.xxs.jpa.util.JsonUtil;
import cug.xxs.jpa.util.Result;
import cug.xxs.jpa.vo.ModelVo;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * \* Created with IntelliJ IDEA.
 * \* @author: 彭诗杰
 * \* @date: 2019/7/27
 * \* @time: 17:07
 * \* Description:
 * \
 */
@RestController
public class ModelController {

    @Resource(name = "modelService")
    private ModelService modelService;

    @RequestMapping(value = "/create", method = RequestMethod.POST)
    public Result create(ModelVo modelVo) {
        Model model = modelService.create(modelVo);
        return Result.setResult(Result.SUCCESS, "创建模型成功！", JsonUtil.objectToJson(model));
    }
}
